<template>
	<view class="mainpadding" v-if="pageShow">
		<view class="" style="padding-bottom: 140rpx;">
			<!--  -->
			<view class="mainpadding ffffff radius">
				<view class="titletext xiaohei fonweight margin_top1">{{dataAll.hourse.name}}</view>
				<view class="smalltext xiaohui margin_top1">
					<text class="margin_right1" v-for="(value,key,index) in dataAll.hourse.attr_text" :key="key">{{key}}-{{value}}</text>
				</view>
			</view>
			<!--  -->
			<view class="ffffff radius margin_top mainpadding">
				<view class="fonweight titletext xiaohei">入住信息</view>
				<view class="flextop margin_top">
					<view class="ershiba xiaohei">入住人</view>
					<view class="xiahuaxian " style="width: 79%;">
						<input class="ershiba xiaohei" placeholder="请输入入住人姓名" type="text" v-model="people_name"/>
					</view>
				</view>
				<view class="flextop margin_top">
					<view class="ershiba xiaohei">联系手机</view>
					<view class="xiahuaxian " style="width: 79%;">
						<input class="ershiba xiaohei" placeholder="请输入手机号" type="number" v-model="people_mobile"/>
					</view>
				</view>
			</view>
		</view>
		<view class="gudingdb ffffff mainpadding flexbetween">
			<view class="xiaocheng strongtext">￥
				<text class="bigtext fonweight xiaocheng">{{dataAll.pay_price}}</text>
			</view>
			<view class="huabtn flexcenter" @click="tzzzf">立即预定</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid: "",
				dataAll: {},
				pageShow: false,
				people_name:"",
				people_mobile:"",
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods: {
			init() {
				httpRequest.request('/api/Hotelordercl/sure', 'GET', {
					hotel_type_id: this.listid
				}, false, false, false).then(res => {
					this.dataAll = res.data
					this.pageShow = true
				})
			},
			// 跳转支付
			tzzzf() {
				if(this.people_name==""){
					httpRequest.toast("请输入入住人姓名")
					return false
				}
				if(this.people_mobile==""){
					httpRequest.toast("请输入手机号")
					return false
				}
				httpRequest.request("/api/hotelordercl/create_order", 'GET', {
					hotel_type_id:this.listid,
					people_name:this.people_name,
					people_mobile:this.people_mobile,
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let data = {
							order_id:res.data.id,
							pay_price:res.data.pay_price,
							pay_score:this.dataAll.score,
							type:2
						}
						uni.redirectTo({
							url: '/pages_index/zhifuTwo?msg='+encodeURIComponent(JSON.stringify(data))
						})
					}
				})
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.huabtn {
		width: 295rpx;
		height: 80rpx;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		background-color: #FF9341;
	}

	.dqline {
		width: 2rpx;
		height: 21rpx;
		background-color: #EFEFEF;
	}

	.hhbtn {
		width: 89rpx;
		height: 37rpx;
		border-radius: 37rpx 37rpx 37rpx 37rpx;
		font-size: 24rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #999999;
		border: 2rpx solid #999999;
	}
</style>